<template>
  <div>
    <h1>计数器</h1>
    <h2>{{count}}</h2>
    <button @click="increment()">+</button>
  </div>
</template>

<script lang='ts'>
import {ref,reactive} from 'vue'
export default{
 setup(){
  return{}
 },
 data(){
  return{
    count:0
  }
 },
 methods:{
  increment(){
    this.count++
  }
 },
 watch:{
  count:{
    handler:function(newval,oldval){
      console.log(newval,oldval)
    },
    immediate:true
  }
 }
}
</script>

<style lang='scss' scoped>
</style>